import { ArgumentMetadata, Injectable, PipeTransform } from '@nestjs/common';

@Injectable()
export class GlobalPipe implements PipeTransform {
  transform(value: any, metadata: ArgumentMetadata) {
    console.group('globalPipe in');
    console.log(
      'globalPipe in',
      metadata.type,
      metadata.metatype,
      metadata.data,
    );
    if (typeof metadata.metatype === 'function') {
      console.log(new metadata.metatype());
    }
    console.groupEnd();
    return value;
  }
}
